package com.ghbank.rdws.biz.service.impl;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ghbank.rdws.biz.repository.SysDataSourceConfigRepository;
import com.ghbank.rdws.biz.service.SysDataSourceConfigService;
import com.ghbank.rdws.common.entity.SysDataSourceConfig;
import com.google.common.collect.Lists;

@Service
public class SysDataSourceConfigServiceImpl implements SysDataSourceConfigService {
    @Autowired
    private SysDataSourceConfigRepository sysDataSourceConfigRepository;

    @Override
    public SysDataSourceConfig findById(long id) {
        return sysDataSourceConfigRepository.findById(id).get();
    }

    @Override
    public List<SysDataSourceConfig> findAll() {
        Iterable<SysDataSourceConfig> configs = sysDataSourceConfigRepository.findAll();
        if (configs == null) {
            return Collections.emptyList();
        }
        return Lists.newArrayList((configs));
    }

    @Override
    public List<SysDataSourceConfig> findByIds(HashSet<String> ids) {
        sysDataSourceConfigRepository.findByIdIn(ids);
         return null;
    }

}
